import 'package:flutter/material.dart';
import './ListViewHelp.dart';



class pj_Page extends StatelessWidget {
  List<Tab> _Tabs = <Tab>[
    new Tab(text: '待评价5'),
    new Tab(text: '已评价2'),
  ];

  
  @override
  Widget build(BuildContext context) {
    return new DefaultTabController(
      length: _Tabs.length,
      child: new Scaffold(
        appBar: new AppBar(
          leading: IconButton(icon: Icon(Icons.arrow_back), onPressed: () {}),
          title: Center(child:Text("我的评价")),
          actions: <Widget>[
            IconButton(icon: Icon(Icons.help), onPressed: () {}),//帮助按钮
          ],
          bottom: new TabBar(
            tabs: _Tabs,
            isScrollable: true,
          ),
        ),
        body: new TabBarView(
          children: _Tabs.map((Tab tab) {
            if(tab.text=='待评价5'){
              return new Center(
                child: new ListView.builder(
                  itemCount: 5, //count 数值设置
                  itemBuilder: (BuildContext context, int index) {
                    //todo 不同页面返回不同类型的Item
                    return new Center(
                      child:new Card(child:buildItem1(context, index,1))
                    );
                  },
                )
              );
            }else if(tab.text=='已评价2')
            {
              return new Center(
                child: new ListView.builder(
                  itemCount: 2, //count 数值设置
                  itemBuilder: (BuildContext context, int index) {
                    //todo 不同页面返回不同类型的Item
                    return new Center(
                      child:new Card(child:buildItem2(context, index))
                    );
                  },
                )
              );
            }
          }).toList(),
        ),
      ),
    );
  }
}
